#!/bin/bash

#Script used to install some basic softwares and gitrepositories 

if [[ -z "$SYSTEM_GIT_HOME" ]]; then
    export SYSTEM_GIT_HOME="$HOME/gitworkspace"
fi

init_softs=(
    w3m
    vim
    vim-gnome
    ctags
    htop
    git
    tmux
    ipython
    python-dev
    zsh
    nload
    terminology
    silversearch-ag
)


__init_soft_list() {
   
    for soft in ${init_softs[@]} ; do
        # if the soft name not found as command and not found in installed packages then install 
        if [[  -z $(which ${soft}) &&  -z $(dpkg --list |grep ${soft}) ]]; then
            sudo apt-get install ${soft};
        else
            echo -e "\nsoft ${soft} already exists\n"
        fi

    done
}

init_git_repos=( 
    fonts
    oh-my-zsh
    oh-my-zsh-powerline-theme
    tmux-powerline
)

__init_init_git_repos() {

   for repo in ${init_git_repos[@]} ; do
        
        if [[ ! -d "$SYSTEM_GIT_HOME/$repo" ]]; then
            echo -e "\nCloning repository ${repo}...\n"
            git clone https://github.com/theo-l/${repo}.git $SYSTEM_GIT_HOME/${repo}
        else
            echo -e "\nRepository $repo already exists\n"
        fi
   done
}



#invoking configure methods
__init_soft_list
__init_init_git_repos


